package com.wu.study.controller;

import com.wu.entity.User;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
public class MyController {

    @GetMapping("/hello")
    @ResponseBody
    public User hello(){
        User u = new User();
        u.setName("小明");
        u.setAge(22);
        u.setAddress("北京朝阳");

        return u;
    }

    @GetMapping("/login")
    @ResponseBody
    public String login(String username,String password){
        if(StringUtils.isNotBlank(username)&&StringUtils.isNotBlank(password)){
            return "success";
        }else{
            return "false";
        }

    }
}
